package com.cheetah.start.common.schedule;

import com.cheetah.start.common.domain.Server;
import lombok.extern.slf4j.Slf4j;
import org.noear.solon.annotation.Component;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * @author 25175
 * @date 2022/5/10 10:50
 */
@Slf4j
@Component
public class SystemInfoSchedule {

    @Scheduled(fixedRate = 1000)
    public void systemInfo() {
        Server server = null;
        try {
            server = new Server();
            server.serverInfo();
        } catch (Exception e) {
            log.error("系统信息获取异常", e);
        }
        log.info("系统使用率mem:{} disk:{} cpu:{}", server.getMemUse(), server.getDiskUse(),server.getCpuUse());
    }
}
